<?php

namespace app\api\controller;

use app\logic\checkin\CheckinLogic;
use app\common\controller\Frontend;

class Checkin extends Frontend
{
    protected array $noNeedLogin = [];

    protected array $noNeedPermission = [];

    protected CheckinLogic $checkinLogic;

    public function initialize(): void
    {
        parent::initialize();

        $this->checkinLogic = new CheckinLogic();
    }

    /**
     * 签到
     */
    public function checkin(): void
    {
        $result = $this->checkinLogic->checkin($this->auth->id);
        if (!$result['status']) {
            $this->error($result['message'], $result['data']);
        }else{
            $this->success($result['message'], $result['data']);
        }
    }
}